<%@page contentType="text/html; charset=euc-kr"%>
<%@page import="java.util.List" %>
<%@page import="java.util.Iterator" %>
<%@page import="com.iheart.member.model.MemberMModel"%>
<%@page import="com.iheart.address.AddressManager"%>
<%@page import="com.iheart.message.box.MsgBoxManager"%>
<%@page import="com.iheart.statistics.StatisticsManager"%>
<%@page import="com.iheart.member.MemberManager"%>
<jsp:useBean id="searchM" class="com.iheart.common.model.SearchModel" scope="page"/>
<jsp:setProperty name="searchM" property="*"/>
<jsp:useBean id="iwebUtil" class="com.iheart.common.IWEBUtil" scope="page"/>
<%
	MemberMModel sesM = null;
	
	if ( session.getAttribute("USER") != null ) {
		sesM = (MemberMModel)session.getAttribute("USER");
		searchM.setLogId(sesM.getLogId());
	} else {
		response.sendRedirect(request.getContextPath() + "/noPermission.jsp");
		return;
	}
	
	String fName = "";
	String mode = iwebUtil.nvlCheck(request.getParameter("mode"));
	if("addrMng".equals(mode)){
		AddressManager addrM = new AddressManager();
		fName = addrM.getAddrExport(sesM,searchM);	
	} else if("SendMsgBox".equals(mode)){
		MsgBoxManager msgM = new MsgBoxManager();
		fName = msgM.getMsgBoxExport(sesM,searchM);
	} else if("SMSStat".equals(mode)){
		StatisticsManager statM = new StatisticsManager();
		fName = statM.getMsgTypeExport(sesM,searchM);		
	} else if("SMSTotStat".equals(mode)){
		StatisticsManager statM = new StatisticsManager();
		fName = statM.getUserDateListExport(sesM,searchM);
//	} else if("addrUpload".equals(mode)){
//		AddressManager addrM = new AddressManager();
//		fName = addrM.getAddrExcelErrorExport(sesM,searchM);  			
	}
	
	
	
	response.sendRedirect(request.getContextPath()+"/download.do?fName="+fName);
	 
%>